/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.srcptit.javatrainning.hieptq.btvn2;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;

/**
 *
 * @author Hiep
 */
public class Bai1 {
    public static void main(String[] args) throws IOException {
        BufferedReader br=new BufferedReader(new FileReader("b1.txt"));
        String s=br.readLine();
        System.out.println("moi ban nhap so >0 can chuyen ơ he 10: "+s);
        int n=Integer.parseInt(s);
         s=br.readLine();
        System.out.println("he co so b(1<b<=36): "+s);
        int b=Integer.parseInt(s);
        int a[]=new int[100];
        int k=0,i=0,j;
        while(n!=0){
            k=n%b;n=n/b;
            if(k>=0 && k<=9) a[i++]=k;
            else
                a[i++]=55+k;
        }
         System.out.print("so chuyen sang he co so "+b+" la: ");
         for(j=i-1;j>=0;j--)
             System.out.print(""+a[j]);
             System.out.println("");
    }
}
